<template>
  <t-layout-page class="t_detail_demo">
    <t-layout-page-item>
      <t-detail
        :listTypeInfo="DataSource.listTypeInfo"
        :dataList="DataSource.dataList"
        :descData="DataSource.descData"
        :descColumn="2"
      >
        <template #slotName>
          <span>{{ DataSource.dataList.stocktakePlanNo }}</span>
          <span>--</span>
          <span>{{ DataSource.dataList.planStocktakeUserName }}</span>
        </template>
      </t-detail>
    </t-layout-page-item>
  </t-layout-page>
</template>
<script setup lang="ts">
const DataSource: any = reactive({
  listTypeInfo: {
    stockTakeTypeList: [
      {
        label: "在制品",
        value: 1
      },
      {
        label: "待检品",
        value: 2
      },
      {
        label: "合格品",
        value: 3
      },
      {
        label: "报废品",
        value: 4
      }
    ]
  },
  dataList: {
    id: "1498904492217241602",
    stocktakePlanNo: "PD-YX-20220302002",
    workshopId: 301,
    workshopLabel: "压型车间",
    planStocktakeDate: "2022-03-03",
    warehouseId: 1,
    warehouseName: "压型电极仓",
    stocktakeJobStatus: 4,
    stocktakeJobStatusLabel: "待盘点录入",
    stocktakeType: 2,
    stocktakeTypeLabel: "临时盘点",
    originTypeList: "[1, 3]",
    originTypeListLabel: "在制品,合格品",
    planStocktakeUserName: "张三",
    planStocktakeUserId: 0,
    createRemark: "测试"
  },
  descData: [
    {
      label: "盘点单编号：",
      fieldName: "stocktakePlanNo",
      value: ""
    },
    {
      label: "盘点单状态：",
      fieldName: "stocktakeJobStatusLabel",
      value: ""
    },
    {
      label: "盘点负责人：",
      fieldName: "planStocktakeUserName",
      value: ""
    },
    {
      label: "计划盘点日期：",
      fieldName: "planStocktakeDate",
      value: "",
      tooltip: "tooltip字符串显示"
    },
    {
      label: "插槽显示编号+负责人：",
      slotName: "slotName",
      span: 4,
      value: ""
    },
    {
      label: "字典回显：",
      fieldName: "stocktakeJobStatus",
      value: "",
      filters: {
        list: "stockTakeTypeList"
      }
    },
    {
      label: "车间：",
      fieldName: "workshopLabel",
      value: ""
    },
    {
      label: "仓库：",
      fieldName: "warehouseName",
      value: ""
    },
    {
      label: "盘点所有物料：",
      fieldName: "originTypeListLabel",
      value: ""
    },
    {
      label: "备注：",
      fieldName: "createRemark",
      value: "",
      span: 4
    }
  ]
});
onMounted(() => {
  DataSource.descData.map((item: { value: any; fieldName: string | number }) => {
    item.value = DataSource.dataList[item.fieldName];
  });
});
</script>
